#include <stdio.h>

int main()
{
	long evenSum = 2;
	long sum = 3;
	long lastVal = 2;
	int i;
	
	while(1)
	{
		long temp = lastVal;
		lastVal = sum;
		
		if(temp > 2 && temp % 2 == 0)
		{
			evenSum += temp;
		}
		
		sum += temp;
		
		if(lastVal > 4000000l)
		{
			break;
		}
	}

	printf("%ld\n", evenSum);
	
	return 0;
}